/**
 * 描述: 服务-首页管理
 * 版权: Copyright (c) 2019
 * 公司: 深圳市网商天下科技开发有限公司
 * 作者: 许堉颖
 * 版本: 1.0.0
 * 创建时间: 2019/04/29 16:52
 */
import {Service, RequestParams} from 'vue-element-simple';

// ====================机场管理
/**
 * 分页获取机场列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetAirportList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('name', params['name']);
  return await this.getService(`/admin/airport/getPageList`, request);
};

/**
 * 根据id获取机场信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetAirportDetails = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('id', params['id'], 1);
  return await this.getService(`/admin/airport/getDetailsById`, request);
};
/**
 * 添加机场
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddAirport = async function (params = {}) {
  const request = new RequestParams();
  // 机场标题
  request.put('name', params['name']).checkSpecial('机场名称');
  // 是否支持举牌服务
  request.put('placards', params['placards']).checkEmpty('是否支持举牌服务');
  // 举牌价格
  request.put('price', params['price'])
  return await this.getService(`/admin/airport/create`, request);
};

/**
 * 编辑机场
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyAirport = async function (params = {}) {
  const request = new RequestParams();
  // 机场id
  request.put('id', params['id']).checkEmpty('机场ID');
  // 机场标题
  request.put('name', params['name']).checkEmpty('机场名称');
  // 是否支持举牌服务
  request.put('placards', params['placards']).checkEmpty('是否支持举牌服务');
  // 举牌价格
  request.put('price', params['price'])
  return await this.getService(`/admin/airport/update`, request);
};

/**
 * 删除机场
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteAirport = async function (params = {}) {
  const request = new RequestParams();
  // 机场id
  request.put('id', params['id']).checkEmpty('机场ID');
  return await this.getService(`/admin/airport/delete`, request);
};

/**
 * 获取所有机场
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetAllAirport = async function () {
  const request = new RequestParams();
  return await this.getService(`/admin/airport/getAll`, request);
};
// ====================机场管理

// ====================车辆类型管理
/**
 * 分页获取车辆类型列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetCarTypeList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('name', params['name']);
  return await this.getService(`/admin/carType/getPageList`, request);
};

/**
 * 根据id获取车辆类型信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetCarTypeDetails = async function (params = {}) {
  const request = new RequestParams();
  // 车辆类型id
  request.put('id', params['id'], 1);
  return await this.getService(`/admin/carType/getDetailsById`, request);
};
/**
 * 添加车辆类型
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddCarType = async function (params = {}) {
  const request = new RequestParams();
  // 车辆类型标题
  request.put('name', params['name']).checkSpecial('车辆类型名称');
  // 权重
  request.put('orderNumber', params['orderNumber'], 1);
  // 座位数
  request.put('seat', params['seat']).checkEmpty('座位数');
  // 图片
  request.put('icon', params['icon']).checkEmpty('图片');
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/carType/create`, request);
};

/**
 * 编辑车辆类型
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyCarType = async function (params = {}) {
  const request = new RequestParams();
  // 车辆类型id
  request.put('id', params['id']).checkEmpty('车辆类型ID');
  // 车辆类型标题
  request.put('name', params['name']).checkSpecial('车辆类型名称');
  // 权重
  request.put('orderNumber', params['orderNumber'], 1);
  // 座位数
  request.put('seat', params['seat']).checkEmpty('座位数');
  // 图片
  request.put('icon', params['icon']).checkEmpty('图片');
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/carType/update`, request);
};

/**
 * 删除车辆类型
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteCarType = async function (params = {}) {
  const request = new RequestParams();
  // 车辆类型id
  request.put('id', params['id']).checkEmpty('车辆类型ID');
  return await this.getService(`/admin/carType/delete`, request);
};

/**
 * 修改车辆类型状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationChangeCarTypeStatus = async function (params = {}) {
  const request = new RequestParams();
  // 车辆类型id
  request.put('id', params['id']).checkEmpty('车辆类型ID');
  // 状态
  request.put('status', params['status']).checkEmpty('状态');
  return await this.getService(`/admin/carType/updateStatus`, request);
};

/**
 * 获取所有车辆类型
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetAllCarType = async function () {
  const request = new RequestParams();
  return await this.getService(`/admin/carType/getChoose`, request);
};

// ====================车辆类型管理

// ====================车辆管理
/**
 * 分页获取车辆列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetCarList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('name', params['name']);
  // 车辆类型id
  request.put('carType', params['carType']);
  return await this.getService(`/admin/car/getPageList`, request);
};

/**
 * 根据类型获取车辆列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetCarListByCarType = async function (params = {}) {
  const request = new RequestParams();
  // 车辆类型
  request.put('type', params['type']);
  return await this.getService(`/admin/car/getChoose`, request);
};

/**
 * 根据类型获取车辆列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetCarNumberListByCar = async function (params = {}) {
  const request = new RequestParams();
  // 车辆类型
  request.put('id', params['id']);
  request.put('chooseId', params['chooseId']);
  request.put('type', params['type']);
  return await this.getService(`/admin/car/getPlateNumber`, request);
};

/**
 * 根据id获取车辆信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetCarDetails = async function (params = {}) {
  const request = new RequestParams();
  // 车辆id
  request.put('id', params['id'], 1);
  return await this.getService(`/admin/car/getDetailsById`, request);
};
/**
 * 添加车辆
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddCar = async function (params = {}) {
  const request = new RequestParams();
  // 车辆品牌
  request.put('name', params['name']).checkEmpty('车辆品牌');
  // 权重
  request.put('orderNumber', params['orderNumber']);
  // 型号
  request.put('modelNumber', params['modelNumber']).checkEmpty('型号');
  // 车牌号
  request.put('plateNumber', params['plateNumber']).checkEmpty('车牌号');
  // 车牌号
  request.put('numberList', params['numberList']).checkEmpty('车牌号');
  // 颜色
  request.put('appearance', params['appearance']).checkEmpty('颜色');
  // 所属车辆类型
  request.put('carType', params['carType']).checkEmpty('所属车辆类型');
  // 动力类型
  request.put('type', params['type']).checkEmpty('动力类型');
  // 座位数
  request.put('seat', params['seat']).checkEmpty('座位数');
  // 图片
  request.put('icon', params['icon']).checkEmpty('图片');
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/car/create`, request);
};

/**
 * 编辑车辆
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyCar = async function (params = {}) {
  const request = new RequestParams();
  // 车辆id
  request.put('id', params['id']).checkEmpty('车辆ID');
  // 车辆品牌
  request.put('name', params['name']).checkEmpty('车辆品牌');
  // 权重
  request.put('orderNumber', params['orderNumber']);
  // 型号
  request.put('modelNumber', params['modelNumber']).checkEmpty('型号');
  // 车牌号
  request.put('plateNumber', params['plateNumber']).checkEmpty('车牌号');
  // 车牌号
  request.put('numberList', params['numberList']).checkEmpty('车牌号');
  // 颜色
  request.put('appearance', params['appearance']).checkEmpty('颜色');
  // 所属车辆类型
  request.put('carType', params['carType']).checkEmpty('所属车辆类型');
  // 动力类型
  request.put('type', params['type']).checkEmpty('动力类型');
  // 座位数
  request.put('seat', params['seat']).checkEmpty('权重');
  // 图片
  request.put('icon', params['icon']).checkEmpty('图片');
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/car/update`, request);
};

/**
 * 删除车辆
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteCar = async function (params = {}) {
  const request = new RequestParams();
  // 车辆id
  request.put('id', params['id']).checkEmpty('车辆ID');
  return await this.getService(`/admin/car/delete`, request);
};

/**
 * 修改车辆状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationChangeCarStatus = async function (params = {}) {
  const request = new RequestParams();
  // 车辆id
  request.put('id', params['id']).checkEmpty('车辆ID');
  // 状态
  request.put('status', params['status']).checkEmpty('状态');
  return await this.getService(`/admin/car/updateStatus`, request);
};

// ====================车辆管理

// ====================司机管理
/**
 * 分页获取司机列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetDriverList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('name', params['name']);
  return await this.getService(`/admin/driver/getPageList`, request);
};

/**
 * 根据id获取司机信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetDriverDetails = async function (params = {}) {
  const request = new RequestParams();
  // 司机id
  request.put('id', params['id'], 1);
  return await this.getService(`/admin/driver/getDetailsById`, request);
};
/**
 * 添加司机
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddDriver = async function (params = {}) {
  const request = new RequestParams();
  // 名称
  request.put('nickname', params['nickname']).checkEmpty('司机姓名');
  // 要绑定的用户id
  request.put('userId', params['userId']);
  // 性别
  request.put('gender', params['gender']);
  // 手机号码
  request.put('mobile', params['mobile']).checkEmpty('手机号码');
  // 邮箱
  request.put('email', params['email']);
  // 身份证号
  request.put('idCard', params['idCard']);
  // 身份证照
  request.put('certificateImg', params['certificateImg']);
  // 可使用的车辆
  request.put('vehicle', params['vehicle']);
  // 驾龄
  request.put('drivingAge', params['drivingAge']);
  // 驾照
  request.put('driverImg', params['driverImg']);
  // 联系地址
  request.put('address', params['address']);
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/driver/create`, request);
};

/**
 * 编辑司机
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyDriver = async function (params = {}) {
  const request = new RequestParams();
  // 司机id
  request.put('id', params['id']).checkEmpty('司机ID');
  // 名称
  request.put('nickname', params['nickname']).checkEmpty('司机姓名');
  // 性别
  request.put('gender', params['gender']);
  // 手机号码
  request.put('mobile', params['mobile']).checkEmpty('手机号码');
  // 身份证号
  request.put('idCard', params['idCard']);
  // 身份证照
  request.put('certificateImg', params['certificateImg']);
  // 可使用的车辆
  request.put('vehicle', params['vehicle']);
  // 驾龄
  request.put('drivingAge', params['drivingAge']);
  // 驾照
  request.put('driverImg', params['driverImg']);
  // 联系地址
  request.put('address', params['address']);
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/driver/update`, request);
};

/**
 * 删除司机
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteDriver = async function (params = {}) {
  const request = new RequestParams();
  // 司机id
  request.put('id', params['id']).checkEmpty('司机ID');
  return await this.getService(`/admin/driver/delete`, request);
};

/**
 * 修改司机上下线状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationChangeDriverStatus = async function (params = {}) {
  const request = new RequestParams();
  // 司机id
  request.put('id', params['id']).checkEmpty('司机ID');
  // 司机状态
  request.put('status', params['status']).checkEmpty('司机ID');
  return await this.getService(`/admin/driver/updateStatus`, request);
};

/**
 * 获取所有司机列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetAllDriver = async function () {
  const request = new RequestParams();
  return await this.getService(`/admin/driver/getAll`, request);
};

/**
 * 通过文件地址导入司机列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationImportDriverData = async function (params = {}) {
  const request = new RequestParams();
  // 文件地址
  request.put('address', params['address']).checkEmpty('文件地址');
  return await this.getService(`/admin/driver/importData`, request);
};
// ====================司机管理

// ====================核销员管理
/**
 * 分页获取核销员列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetVerifierList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('name', params['name']);
  return await this.getService(`/admin/verifier/getPageList`, request);
};

/**
 * 根据id获取核销员信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetVerifierDetails = async function (params = {}) {
  const request = new RequestParams();
  // 核销员id
  request.put('id', params['id'], 1);
  return await this.getService(`/admin/verifier/getDetailsById`, request);
};
/**
 * 添加核销员
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddVerifier = async function (params = {}) {
  const request = new RequestParams();
  // 名称
  request.put('nickname', params['nickname']).checkEmpty('核销员姓名');
  // 要绑定的用户id
  request.put('userId', params['userId']);
  // 性别
  request.put('gender', params['gender']);
  // 手机号码
  request.put('mobile', params['mobile']).checkEmpty('手机号码');
  // 邮箱
  request.put('email', params['email']);
  // 身份证号
  request.put('idCard', params['idCard']);
  // 身份证照
  request.put('certificateImg', params['certificateImg']);
  // 联系地址
  request.put('address', params['address']);
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/verifier/create`, request);
};

/**
 * 编辑核销员
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyVerifier = async function (params = {}) {
  const request = new RequestParams();
  // 核销员id
  request.put('id', params['id']).checkEmpty('核销员ID');
  // 名称
  request.put('nickname', params['nickname']).checkEmpty('核销员姓名');
  // 性别
  request.put('gender', params['gender']);
  // 手机号码
  request.put('mobile', params['mobile']).checkEmpty('手机号码');
  // 身份证号
  request.put('idCard', params['idCard']);
  // 身份证照
  request.put('certificateImg', params['certificateImg']);
  // 联系地址
  request.put('address', params['address']);
  // 备注
  request.put('remark', params['remark']);
  return await this.getService(`/admin/verifier/update`, request);
};

/**
 * 删除核销员
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteVerifier = async function (params = {}) {
  const request = new RequestParams();
  // 核销员id
  request.put('id', params['id']).checkEmpty('核销员ID');
  return await this.getService(`/admin/verifier/delete`, request);
};

/**
 * 修改核销员上下线状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationChangeVerifierStatus = async function (params = {}) {
  const request = new RequestParams();
  // 核销员id
  request.put('id', params['id']).checkEmpty('核销员ID');
  // 核销员状态
  request.put('status', params['status']).checkEmpty('核销员ID');
  return await this.getService(`/admin/verifier/updateStatus`, request);
};

/**
 * 获取所有核销员列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetAllVerifier = async function () {
  const request = new RequestParams();
  return await this.getService(`/admin/verifier/getAll`, request);
};

/**
 * 通过文件地址导入核销员列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationImportVerifierData = async function (params = {}) {
  const request = new RequestParams();
  // 文件地址
  request.put('address', params['address']).checkEmpty('文件地址');
  return await this.getService(`/admin/verifier/importData`, request);
};
// ====================核销员管理

// ====================原因管理
/**
 * 分页获取拒接原因列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetReasonList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('name', params['name']);
  return await this.getService(`/admin/reason/getPageList`, request);
};

/**
 * 根据id获取拒接原因信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetReasonDetails = async function (params = {}) {
  const request = new RequestParams();
  // 拒接原因id
  request.put('id', params['id'], 1);
  return await this.getService(`/admin/reason/getDetailsById`, request);
};
/**
 * 添加拒接原因
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddReason = async function (params = {}) {
  const request = new RequestParams();
  // 原因适用类型
  request.put('type', params['type']).checkEmpty('原因适用类型');
  // 拒绝原因
  request.put('content', params['content']).checkEmpty('拒绝原因');
  return await this.getService(`/admin/reason/create`, request);
};

/**
 * 编辑拒接原因
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyReason = async function (params = {}) {
  const request = new RequestParams();
  // 拒接原因id
  request.put('id', params['id']).checkEmpty('拒接原因ID');
  // 原因适用类型
  request.put('type', params['type']).checkEmpty('原因适用类型');
  // 拒绝原因
  request.put('content', params['content']).checkEmpty('拒绝原因');
  return await this.getService(`/admin/reason/update`, request);
};

/**
 * 删除拒接原因
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteReason = async function (params = {}) {
  const request = new RequestParams();
  // 拒接原因id
  request.put('id', params['id']).checkEmpty('拒接原因ID');
  return await this.getService(`/admin/reason/delete`, request);
};

/**
 * 修改原因状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationChangeReasonStatus = async function (params = {}) {
  const request = new RequestParams();
  // 原因id
  request.put('id', params['id']).checkEmpty('原因ID');
  // 状态
  request.put('status', params['status']).checkEmpty('状态');
  return await this.getService(`/admin/reason/updateStatus`, request);
};
// ====================原因管理
// ====================分享信息管理
/**
 * 获取分享信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetShareConfig = async function () {
  const request = new RequestParams();
  return await this.getService(`/admin/system/getConfig/share`, request);
};

/**
 * 修改分享信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyShareConfig = async function (params = {}) {
  const request = new RequestParams();
  // 内容
  request.put('picture', params['backgroundPicture']).checkEmpty('背景图片');
  return await this.getService(`/admin/system/saveConfig/share`, request);
};
